#!/bin/sh
#
# $Id: postinst 38 2011-11-26 16:56:14Z imooreyahoo@gmail.com $
#
# see: dh_installdeb(1)

set -e

. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions

case "$1" in

    configure)
    
		# Fix permissions
		omv_install_fixperms
		
		# Add key
		cat <<EOF | apt-key add -
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)

mQENBE7J9CIBCAC7XLs8MGmmI+Rp82xFQ/Nnz9LYcAJBNyW8TDkME9RAx8+XD6fU
xfrjwpLKkmb0DWZvWZMLFC0qAAB7CAHTVVIuXmJnx8RnkmPJZxHlixRlpjyUbjjk
WeieZufBBgxM1ASnueB7Ih/9uEsnHm2kRSxrSDAdlYYJKroN17P0k2OiqlG/KfTd
JuaqIWr+U7dDWTt3w5831WNqcgA1A9kyvVXvtS9p3vyEf7o44n9fyMSM2lMFNNwn
jbJ/2kznAtKeuYwciCVLDDqVyGumvOhUYvC9MpUV8l/gpkfr2MiHCXQf5KeFETS+
BHzBy4dcUi4PLpIWwA8p2NL0/8Bq6J1vKcHZABEBAAG0Jk9NVi1QbHVnaW5zLm9y
ZyA8aW5mb0BvbXYtcGx1Z2lucy5vcmc+iQE4BBMBAgAiBQJOyfQiAhsDBgsJCAcD
AgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBo6jxnNRLLz8v1CACq/xPntAQgCA7yQcyc
9skY+oPFdynJRASEfd2gclOo2R2QnrNsFu5AihHAxunFPvxfDcxSE7KVICE7qq4t
vmqISOJifKHdXSd/2HPrAcNjWdE92lRD/vu/UIOvSy80gpIOMNMsrKmQdXrpdm4J
+U/Sdt86jg44WTJh0cvBekOncoNM67djTAHwnBUBkbx9PRXy5osmrxcf5iYXeMCW
TWnECK+M6LoAZjjqbkTNWqa9rBvWGhSkUwGhfUxI3vAGX2icmsr91TtLbkGlTrbq
isXmuIABr6WOJKvhwF8ZGj/4CcnXXmpvMTe1F6drm+aDxyt0BAJ3yZKOLzo3+HjY
+IpRuQENBE7J9CIBCADYe0rxi6E36djzAuoFAKsj6TuHzI5KdH3kvucXqIYRDemB
pU6xzuPXVEAWLT6Dk1F7xsext2fKzjzIrcpmBpvE7v7cFON5E1lWO+KtG1oTjzAo
lvSXtnpyY5WWCGjmytkjp0IvPryePlUyLMh8hjqrG/MtnwG16zQ5WYIZEu+M03q6
Zvopd01xzAf4cwhR5QOl4UrRwSLcmdPRdpLwv6muPBMKlbwywarAyM7mS09fumSn
0O/r/PG8kcViuAc/CQs70ckZDNyKEQjnwjPi5+1/xzDOOJY+JeBoNYj87t2k8lO2
3joPESLEOBu/l6dAMQvBthXSqgJqtTHlJQDji/jPABEBAAGJAR8EGAECAAkFAk7J
9CICGwwACgkQaOo8ZzUSy89LrAf8C7fKAB6qIi06pOUZO8xSvJJ41mSbuu8BOtRB
tS+5+m1HiJLNkiC0k/RsDdZkWnrn364A6JGMjxzPrGg/mwFtb3sOUH6N97se+lab
qtL1/JP3eUNKj2/ODkoiYaRWVuHZb5I+BKTqg4Hm8vFj+QBlVEamqSTDkBUzh2YC
OvPt/iAyO7ilTpw+XzPS96B1+ikxEPZ+1M9C8UlF61zJXG7O2wacRInHm6ypsrQ8
+F8dao2GLzgjfQtUWE4eCHiZLu4S99t1fwsveF52Z88sKcYi2qVW0k/w2ETv//fd
n4JsVy0Wqpyqpq6LdquN/lGemDIADE6PyuHyhJKOAq71w0KdjA==
=+nyf
-----END PGP PUBLIC KEY BLOCK-----
EOF

		# Add source
		echo 'deb http://packages.omv-plugins.org ix main' >/etc/apt/sources.list.d/omv-plugins-org-stable.list
		
		cat <<EOF

=============================================

!! README !!

Be sure to click on the Check button in the
System / Plugins menu after this plugin is
installed.

=============================================				


EOF

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
